﻿using System;
using DnEcuDiag.Ecus.Enums;
using DnEcuDiag.Ecus.Generic;
using DnEcuDiag.Ecus.Kwp;
using DnEcuDiag.Factories;
using NUnit.Framework;
using System.Collections.Generic;

namespace DnEcuDiag.Tests
{
    [TestFixture]
    public class ME31EODBTests
    {
        private KwpEcu _ecu;
        private KwpTestDevice _device;

        [TestFixtureSetUp]
        public void TestSetup()
        {
            _device = new KwpTestDevice();

            EcuDescriptor descriptor = EcuFactory.EcuList.Find(ecuDescriptor => ecuDescriptor.Name == "Bosch Motronic ME3.1 EOBD");

            _ecu = EcuFactory.CreateEcu(descriptor) as KwpEcu;
            Assert.IsNotNull(_ecu);
            _ecu.DiagnosticInterface = _device;
            _ecu.Connect();
        }

        [Test]
        public void TestIdentification()
        {
            Assert.AreEqual("Bosch Motronic ME3.1 EOBD", _ecu.Model);
            Assert.AreEqual("0123456789 ", _ecu.DrawingNumber);
            Assert.AreEqual("0123456789 ", _ecu.HardwareNumber);
            Assert.AreEqual("0x10", _ecu.HardwareVersionNumber);
            Assert.AreEqual("0123456789 ", _ecu.SoftwareNumber);
            Assert.AreEqual("0x85170", _ecu.SoftwareVersionNumber);
            Assert.AreEqual("01234 ", _ecu.OmologationNumber);
            Assert.AreEqual("55 AA 55 AA 55 ", _ecu.IsoCode);
            Assert.AreEqual("19 97 03 31 ", _ecu.ProductionDate);
            Assert.AreEqual("19 97 03 31 ", _ecu.ProgrammingDate);
            Assert.IsNotNull(_ecu.RpmSensor);
            Assert.AreEqual("Engine Speed", _ecu.RpmSensor.Name);
            Assert.IsNotNull(_ecu.SpeedSensor);
            Assert.AreEqual("High Resolution Vehicle Speed", _ecu.SpeedSensor.Name);
            Assert.AreEqual(InitType.Standard, _ecu.InitType);
        }


        [Test]
        public void TestSensors()
        {
            TestSensorValues();
        }

        [Test]
        public void TestFaults()
        {
            Assert.AreNotEqual(0, _ecu.ErrorMemoryStructureDefinition.ErrorDefinitions.Count,
                               "ErrorMemoryStructureDefinition.Count == 0 for ME3.1");
            Assert.AreEqual(77, _ecu.ErrorMemoryStructureDefinition.ErrorDefinitions.Count,
                            "ErrorMemoryStructureDefinition.Count != 37 for ME3.1");

            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            // Three P0100
            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////			
            _device.FaultcodeList = new byte[] { 0x58, 03, 01, 00, 0xE2, 01, 00, 0xE2, 01, 00, 0xE2 };
            _device.Faultcodeinfo = new byte[]
                                         {
                                             0x57, 0x3,
                                             0x01, 0x00,
                                             0xE2, 0x1D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x40,
                                             0x01, 0x00,
                                             0xE2, 0x1D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x40,
                                             0x01, 0x00,
                                             0xE2, 0x1D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x40,
                                         };

            _ecu.ReadFaultCodes();

            Assert.AreEqual(3, _ecu.ActiveFaultCodes.Count, "ActiveFaultCodes.Count == 3 for ME3.1");
            Console.WriteLine(_ecu.ActiveFaultCodes[0].FaultDescription);
            Assert.AreEqual("P0100", (_ecu.ActiveFaultCodes[0]).FaultComponent);
            Assert.AreEqual(
                "Failed Component Code: Air Flow Meter\r\n" +
                "Fault Symptom: Below Minimum Limit\r\n" +
                "Warning Lamp Status: Warning Lamp Illuminated\r\n" +
                "Fault Test State: Test complete for this Error or not applicable.\r\n" +
                "Fault Code Storage State: Error Present at time of request\r\n" +
                "Event Count: 64 count\r\n" +
                "Environmental Condition One: Engine Speed: 1160 rpm\r\n" +
                "Environmental Condition Two: Standardised Load: 9.75 %\r\n" +
                "Environmental Condition Three: Engine Coolant Temperature: -41 °C\r\n" +
                "Environmental Condition Four: Air Temperature: -50.1 °C\r\n" +
                "Environmental Condition Five: Throttle Valve Angle: 0 °\r\n" +
                "Environmental Condition Six: Battery Voltage: 0 volts\r\n",
                _ecu.ActiveFaultCodes[0].FaultDescription);

            _device.FaultcodeList = new byte[] { 0x58, 01, 01, 0x59, 0xE2 };
            _device.Faultcodeinfo = new byte[]
                                         {
                                             0x57, 0x1,
                                             0x01, 0x59,
                                             0xE2, 10, 10, 10, 10, 0xFF, 0xFF, 0xFF
                                         };

            _ecu.ReadFaultCodes();

            Assert.AreEqual(1, _ecu.ActiveFaultCodes.Count, "ActiveFaultCodes.Count == 1 for ME3.1");
            Console.WriteLine(_ecu.ActiveFaultCodes[0].FaultDescription);
            Assert.AreEqual("P0159", (_ecu.ActiveFaultCodes[0]).FaultComponent);
            Assert.AreEqual(
                "Failed Component Code: Lambda Sensor Bank 2 Slow Response (Post Cat)\r\n" +
                "Fault Symptom: Below Minimum Limit\r\n" +
                "Warning Lamp Status: Warning Lamp Illuminated\r\n" +
                "Fault Test State: Test complete for this Error or not applicable.\r\n" +
                "Fault Code Storage State: Error Present at time of request\r\n" +
                "Event Count: 255 count\r\n" +
                "Environmental Condition One: Engine Speed: 400 rpm\r\n" +
                "Environmental Condition Two: Standardised Load: 7.5 %\r\n" +
                "Environmental Condition Three: Engine Coolant Temperature: -28.36 °C\r\n" +
                "Environmental Condition Four: Air Temperature: -45 °C\r\n" +
                "Environmental Condition Five: Throttle Valve Angle: 80.6 °\r\n" +
                "Environmental Condition Six: Battery Voltage: 24.02 volts\r\n",
                _ecu.ActiveFaultCodes[0].FaultDescription);

            _device.FaultcodeList = new byte[] { 0x58, 01, 03, 0x01, 0xE2 };
            _device.Faultcodeinfo = new byte[]
                                         {
                                             0x57, 0x1,
                                             0x03, 0x01,
                                             0xE2, 10, 10, 10, 0xFF, 0xFF, 10, 0x40
                                         };

            _ecu.ReadFaultCodes();

            Assert.AreEqual(1, _ecu.ActiveFaultCodes.Count, "ActiveFaultCodes.Count == 1 for ME3.1");
            Console.WriteLine(_ecu.ActiveFaultCodes[0].FaultDescription);
            Assert.AreEqual("P0301", (_ecu.ActiveFaultCodes[0]).FaultComponent);
            Assert.AreEqual(
                "Failed Component Code: Cylinder 1 Misfire Detected\r\n" +
                "Fault Symptom: Continous (Increased Emissions)\r\n" +
                "Warning Lamp Status: Warning Lamp Illuminated\r\n" +
                "Fault Test State: Test complete for this Error or not applicable.\r\n" +
                "Fault Code Storage State: Error Present at time of request\r\n" +
                "Event Count: 64 count\r\n" +
                "Environmental Condition One: Engine Speed: 400 rpm\r\n" +
                "Environmental Condition Two: Standardised Load: 7.5 %\r\n" +
                "Environmental Condition Three: Engine Coolant Temperature: -28.36 °C\r\n" +
                "Environmental Condition Four: Fuel Level Status: Reserve Light Off\r\n" +
                "Environmental Condition Five: Throttle Valve Angle: 80.6 °\r\n" +
                "Environmental Condition Six: Battery Voltage: 0.94 volts\r\n",
                _ecu.ActiveFaultCodes[0].FaultDescription);

            _device.FaultcodeList = new byte[] { 0x58, 01, 03, 0x01, 0xE2 };
            _device.Faultcodeinfo = new byte[]
                                         {
                                             0x57, 0x1,
                                             0x03, 0x01,
                                             0xE2, 10, 10, 10, 0, 0xFF, 10, 0x40
                                         };

            _ecu.ReadFaultCodes();

            Assert.AreEqual(1, _ecu.ActiveFaultCodes.Count, "ActiveFaultCodes.Count == 1 for ME3.1");
            Console.WriteLine(_ecu.ActiveFaultCodes[0].FaultDescription);
            Assert.AreEqual("P0301", (_ecu.ActiveFaultCodes[0]).FaultComponent);
            Assert.AreEqual(
                "Failed Component Code: Cylinder 1 Misfire Detected\r\n" +
                "Fault Symptom: Continous (Increased Emissions)\r\n" +
                "Warning Lamp Status: Warning Lamp Illuminated\r\n" +
                "Fault Test State: Test complete for this Error or not applicable.\r\n" +
                "Fault Code Storage State: Error Present at time of request\r\n" +
                "Event Count: 64 count\r\n" +
                "Environmental Condition One: Engine Speed: 400 rpm\r\n" +
                "Environmental Condition Two: Standardised Load: 7.5 %\r\n" +
                "Environmental Condition Three: Engine Coolant Temperature: -28.36 °C\r\n" +
                "Environmental Condition Four: Fuel Level Status: Reserve Light On\r\n" +
                "Environmental Condition Five: Throttle Valve Angle: 80.6 °\r\n" +
                "Environmental Condition Six: Battery Voltage: 0.94 volts\r\n",
                _ecu.ActiveFaultCodes[0].FaultDescription);

            _device.FaultcodeList = new byte[] { 0x58, 01, 0xD6, 0x00, 0xE2 };
            _device.Faultcodeinfo = new byte[]
                                         {
                                             0x57, 0x1,
                                             0xD6, 0x00,
                                             0xE8, 10, 10, 10, 4, 0xFF, 10, 0x40
                                         };

            _ecu.ReadFaultCodes();

            Assert.AreEqual(1, _ecu.ActiveFaultCodes.Count, "ActiveFaultCodes.Count == 1 for ME3.1");
            Console.WriteLine(_ecu.ActiveFaultCodes[0].FaultDescription);
            Assert.AreEqual("U1600", (_ecu.ActiveFaultCodes[0]).FaultComponent);
            Assert.AreEqual(
                "Failed Component Code: Immobiliser\r\n" +
                "Fault Symptom: Signal Not Plausible\r\n" +
                "Warning Lamp Status: Warning Lamp Illuminated\r\n" +
                "Fault Test State: Test complete for this Error or not applicable.\r\n" +
                "Fault Code Storage State: Error Present at time of request\r\n" +
                "Event Count: 64 count\r\n" +
                "Environmental Condition One: Engine Speed: 400 rpm\r\n" +
                "Environmental Condition Two: Standardised Load: 7.5 %\r\n" +
                "Environmental Condition Three: Engine Coolant Temperature: -28.36 °C\r\n" +
                "Environmental Condition Four: Immobiliser: Code received\r\n" +
                "Environmental Condition Four: Immobiliser: Key code ok\r\n" +
                "Environmental Condition Four: Immobiliser: Virgin Ecu\r\n" +
                "Environmental Condition Four: Immobiliser: Engine start enabled\r\n" +
                "Environmental Condition Four: Immobiliser: Universal code not received\r\n" +
                "Environmental Condition Four: Immobiliser: Separate line used not used\r\n" +
                "Environmental Condition Four: Immobiliser: EEPROM ok\r\n" +
                "Environmental Condition Five: Throttle Valve Angle: 80.6 °\r\n" +
                "Environmental Condition Six: Battery Voltage: 0.94 volts\r\n",
                _ecu.ActiveFaultCodes[0].FaultDescription);

#warning add p1691
        }

        [Test]
        public void TestSnapshots()
        {
            Int32 i = 0;

            String matchString;
            Byte[] data;

            matchString =
                "Immobiliser\r\n\r\n\tImmobiliser Status\r\n\t\tNo Code Received: True\r\n\t\tCode Unknown: False\r\n\t\t" +
                "Erroneous Key Code/Anntena Defect: True\r\n\t\tVirgin Ecu: False\r\n\t\tEngine Start Disabled: True\r\n\t\tUniversal Code Received: False\r\n\r\n";
            data = new byte[] { 0x55 };
            AssertSnapshot(_ecu, i, data, matchString);

            matchString =
                "Immobiliser\r\n\r\n\tImmobiliser Status\r\n\t\tNo Code Received: False\r\n\t\tCode Unknown: True\r\n\t\t" +
                "Erroneous Key Code/Anntena Defect: False\r\n\t\tVirgin Ecu: True\r\n\t\tEngine Start Disabled: False\r\n\t\tUniversal Code Received: True\r\n\r\n";
            data = new byte[] { 0xAA };
            AssertSnapshot(_ecu, i++, data, matchString);

            matchString =
                "Diagnostic State CAN line (High Speed)\r\n\r\n\tDiagnostic Status\r\n\t\tAbsence of communication with NBC: Present\r\n\t\t" +
                "Absence of communication with NFR: Absent\r\n\t\tAbsence of communication with NCA/NCR: Present\r\n\t\t" +
                "Absence of communication with NAC: Absent\r\n\t\tAbsence of communication with NBA: Present\r\n\r\n";
            data = new byte[] { 0x55 };
            AssertSnapshot(_ecu, i, data, matchString);

            matchString =
                "Diagnostic State CAN line (High Speed)\r\n\r\n\tDiagnostic Status\r\n\t\tAbsence of communication with NBC: Absent\r\n\t\t" +
                "Absence of communication with NFR: Present\r\n\t\tAbsence of communication with NCA/NCR: Absent\r\n\t\t" +
                "Absence of communication with NAC: Present\r\n\t\tAbsence of communication with NBA: Absent\r\n\r\n";
            data = new byte[] { 0xaa };
            AssertSnapshot(_ecu, i++, data, matchString);

            matchString =
                "Autoadaptation Lambda Bank One\r\n\r\n\t\tMultiplication Factor Bank 1 Actual Load: 0.004 ms\r\n\t\t" +
                "Additive Factor Bank 1: -2.66 ms\r\n\t\tMultiplication Factor Bank 1 Low Load: 0.004 ms\r\n\t\t" +
                "Multiplication Factor Bank 1 High Load: 0.004 ms\r\n\r\n";
            data = new byte[] { 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF };
            AssertSnapshot(_ecu, i++, data, matchString);

            matchString = "Throttle potentiometer\r\n\r\n\t\t" +
                          "Throttle 1 Potentiometer: 100 %\r\n\t\t" +
                          "Throttle 2 Potentiometer: 100 %\r\n\t\t" +
                          "Throttle 1 Potentiometer (Standardised for end limit): 118.605 %\r\n\t\t" +
                          "Throttle 2 Potentiometer (Standardised for end limit): 118.605 %\r\n\t\t" +
                          "Throttle Angle: 80.6 °\r\n\t\t" +
                          "Throttle Lower Limit: 0.778 %\r\n\t\t" +
                          "Throttle Lower Limit Self-Adaptation: 9: Learning Complete\r\n\r\n";
            data = new byte[]
                       {
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0x9,
                           0x00, 0xFF
                       };
            AssertSnapshot(_ecu, i++, data, matchString);

            matchString = "Accelerator potentiometer\r\n\r\n\t\t" +
                          "Accelerator 1 Potentiometer: 24.927 %\r\n\t\t" +
                          "Accelerator 2 Potentiometer: 24.927 %\r\n\t\t" +
                          "Accelerator 1 Potentiometer (Standardised for end limit): 24.927 %\r\n\t\t" +
                          "Accelerator 2 Potentiometer (Standardised for end limit): 24.927 %\r\n\t\t" +
                          "Accelerator Pedal Percentage: 0.778 %\r\n\t\t" +
                          "Actual Accelerator value after limitation: 0.63 °\r\n\t\t" +
                          "Target Accelerator value from line characteristics: 0.027 %\r\n\t\t" +
                          "Accelerator Target value: 0.778 %\r\n\r\n";

            data = new byte[]
                       {
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0x9,
                           0x00, 0xFF
                       };
            AssertSnapshot(_ecu, i++, data, matchString);

            matchString = "Lambda Sensor\r\n\r\n\t\t" +
                          "Lambda Sensor Voltage Bank 1 Pre Cat: 4845 mv\r\n\t\t" +
                          "Lambda Sensor Voltage Bank 1 Post Cat: 4845 mv\r\n\t\t" +
                          "Lambda Regulation Bank 1: 0.504\r\n\t\t" +
                          "Lambda Sensor Voltage Bank 2 Pre Cat: 4845 mv\r\n\t\t" +
                          "Lambda Sensor Voltage Bank 2 Post Cat: 4845 mv\r\n\t\t" +
                          "Lambda Regulation Bank 2: 0.504\r\n\r\n";

            data = new byte[]
                       {
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF,
                           0x00, 0xFF
                       };
            AssertSnapshot(_ecu, i++, data, matchString);

            matchString = "Knock Control\r\n\r\n\t\t" +
                          "Reference value for cylinder 1 in order of ignition: 4.688 Volts\r\n\t\t" +
                          "Reference value for cylinder 2 in order of ignition: 4.707 Volts\r\n\t\t" +
                          "Reference value for cylinder 3 in order of ignition: 4.727 Volts\r\n\t\t" +
                          "Reference value for cylinder 4 in order of ignition: 4.746 Volts\r\n\t\t" +
                          "Reference value for cylinder 5 in order of ignition: 4.766 Volts\r\n\t\t" +
                          "Reference value for cylinder 6 in order of ignition: 4.785 Volts\r\n\r\n";

            data = new byte[]
                       {
                           0x00, 0xF0,
                           0x00, 0xF1,
                           0x00, 0xF2,
                           0x00, 0xF3,
                           0x00, 0xF4,
                           0x00, 0xF5,
                           0x00, 0xF6,
                           0x00, 0xF7
                       };
            AssertSnapshot(_ecu, i++, data, matchString);

            matchString = "EOBD Misfire Counter\r\n\r\n\t\t" +
                          "Total EOBD relevent misfires: 1 n°\r\n\t\t" +
                          "Misfire interval count: 2 n°\r\n\t\t" +
                          "Total EOBD relevent misfires for cylinder 1 in order of ignition: 3 n°\r\n\t\t" +
                          "Total EOBD relevent misfires for cylinder 2 in order of ignition: 4 n°\r\n\t\t" +
                          "Total EOBD relevent misfires for cylinder 3 in order of ignition: 5 n°\r\n\t\t" +
                          "Total EOBD relevent misfires for cylinder 4 in order of ignition: 6 n°\r\n\t\t" +
                          "Total EOBD relevent misfires for cylinder 5 in order of ignition: 7 n°\r\n\t\t" +
                          "Total EOBD relevent misfires for cylinder 6 in order of ignition: 8 n°\r\n\r\n";

            data = new byte[]
                       {
                           0x00, 0x1,
                           0x00, 0x2,
                           0x00, 0x3,
                           0x00, 0x4,
                           0x00, 0x5,
                           0x00, 0x6,
                           0x00, 0x7,
                           0x00, 0x8
                       };
            AssertSnapshot(_ecu, i++, data, matchString);

            matchString = "Catalyst Damaging Misfire Counter\r\n\r\n\t\t" +
                          "Total catalyst damaging misfires bank one: 1 n°\r\n\t\t" +
                          "Total catalyst damaging misfires bank two: 2 n°\r\n\t\t" +
                          "Total catalyst damaging misfires for cylinder 1 in order of ignition: 3 n°\r\n\t\t" +
                          "Total catalyst damaging misfires for cylinder 2 in order of ignition: 4 n°\r\n\t\t" +
                          "Total catalyst damaging misfires for cylinder 3 in order of ignition: 5 n°\r\n\t\t" +
                          "Total catalyst damaging misfires for cylinder 4 in order of ignition: 6 n°\r\n\t\t" +
                          "Total catalyst damaging misfires for cylinder 5 in order of ignition: 7 n°\r\n\t\t" +
                          "Total catalyst damaging misfires for cylinder 6 in order of ignition: 8 n°\r\n\r\n";

            data = new byte[]
                       {
                           0x00, 0x1,
                           0x00, 0x2,
                           0x00, 0x3,
                           0x00, 0x4,
                           0x00, 0x5,
                           0x00, 0x6,
                           0x00, 0x7,
                           0x00, 0x8
                       };
            AssertSnapshot(_ecu, i++, data, matchString);

            matchString = "Wheel Speed\r\n\r\n\t\t" +
                          "Wheel Speed Front SX: 0.063 km/h\r\n\t\t" +
                          "Wheel Speed Front DX: 0.125 km/h\r\n\t\t" +
                          "Wheel Speed Rear SX: 0.188 km/h\r\n\t\t" +
                          "Wheel Speed Rear DX: 0.25 km/h\r\n\r\n";

            data = new byte[]
                       {
                           0x00, 0x1,
                           0x00, 0x2,
                           0x00, 0x3,
                           0x00, 0x4,
                           0x00, 0x5,
                           0x00, 0x6,
                           0x00, 0x7,
                           0x00, 0x8
                       };
            AssertSnapshot(_ecu, i++, data, matchString);

            matchString = "Autoadaptation Lambda Bank 2\r\n\r\n\t\t" +
                          "Multiplication Factor Bank 2 Actual Load: 0.004 ms\r\n\t\t" +
                          "Additive Factor Bank 2: 643.72 ms\r\n\t\t" +
                          "Multiplication Factor Bank 2 Low Load: 0.004 ms\r\n\t\t" +
                          "Multiplication Factor Bank 2 High Load: 0.004 ms\r\n\r\n";

            data = new byte[]
                       {
                           0x00, 0xF1,
                           0x00, 0xF2,
                           0x00, 0xF3,
                           0x00, 0xF4,
                           0x00, 0xF5,
                           0x00, 0xF6,
                           0x00, 0xF7,
                           0x00, 0xF8
                       };

            AssertSnapshot(_ecu, i++, data, matchString);

            matchString = "Pre and post Lambda sensor heater resistance\r\n\r\n\t\t" +
                          "Heater resistance bank one pre cat lambda sensor: 2 ohms\r\n\t\t" +
                          "Heater resistance bank 1 pre cat lambda sensor: 4 ohms\r\n\t\t" +
                          "Diagnostic threshold heater resistance bank 1 pre cat lambda sensor: 6 ohms\r\n\t\t" +
                          "Heater resistance bank one post cat lambda sensor: 8 ohms\r\n\t\t" +
                          "Diagnostic threshold heater resistance bank 1 post cat lambda sensor: 10 ohms\r\n\t\t" +
                          "Heater resistance bank 2 pre cat lambda sensor: 12 ohms\r\n\t\t" +
                          "Diagnostic threshold heater resistance bank 2 pre cat lambda sensor: 14 ohms\r\n\t\t" +
                          "Heater resistance bank 2 post cat lambda sensor: 16 ohms\r\n\r\n";


            data = new byte[]
                       {
                           0x00, 0x1,
                           0x00, 0x2,
                           0x00, 0x3,
                           0x00, 0x4,
                           0x00, 0x5,
                           0x00, 0x6,
                           0x00, 0x7,
                           0x00, 0x8
                       };

            AssertSnapshot(_ecu, i++, data, matchString);


            matchString = "Diagnostic Status CAN Line\r\n\r\n\t\t" +
                          "Absence of communication with NBC: Present\r\n\t\t" +
                          "Absence of communication with NFR: Absent\r\n\t\t" +
                          "Absence of communication with NCA/NCR: Absent\r\n\t\t" +
                          "Absence of communication with NAC: Absent\r\n\t\t" +
                          "Absence of communication with NBA: Absent\r\n\t\t" +
                          "Elapsed time with errors NBC: 20 ms\r\n\t\t" +
                          "Elapsed time with errors NFR: 30 ms\r\n\t\t" +
                          "Elapsed time with errors NCA/NCR: 40 ms\r\n\t\t" +
                          "Elapsed time with errors NAC: 50 ms\r\n\t\t" +
                          "Elapsed time with errors NBA: 60 ms\r\n\r\n";


            data = new byte[]
                       {
                           0x00, 0x1,
                           0x00, 0x2,
                           0x00, 0x3,
                           0x00, 0x4,
                           0x00, 0x5,
                           0x00, 0x6,
                           0x00, 0x7,
                           0x00, 0x8
                       };

            AssertSnapshot(_ecu, i++, data, matchString);

            matchString = "Error Counter CAN Line\r\n\r\n\t\t" +
                          "Counter of Errors NBC: 1\r\n\t\t" +
                          "Counter of Errors NFR: 2\r\n\t\t" +
                          "Counter of Errors NCA / NCR: 3\r\n\t\t" +
                          "Counter of Errors NAC: 4\r\n\t\t" +
                          "Counter of Errors NBA: 5\r\n\r\n";


            data = new byte[]
                       {
                           0x00, 0x1,
                           0x00, 0x2,
                           0x00, 0x3,
                           0x00, 0x4,
                           0x00, 0x5,
                           0x00, 0x6,
                           0x00, 0x7,
                           0x00, 0x8
                       };

            AssertSnapshot(_ecu, i++, data, matchString);
        }

        private void TestSensorValues()
        {
            int i = 0;
            TimeStampedMeasurement tsm;
            LocalIdentifier li = _ecu.Sensors[i] as LocalIdentifier;

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x01, 00 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(25.6f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x2 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(2, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x4 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(4, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x8 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(800f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x10 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(640f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x20 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(32f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x0A };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x80 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(128, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x40 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(15.46f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x80 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(23.33f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(10, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 10 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(-70.5f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 10 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(26.6f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 10 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(213.3f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x01, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(80.916f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 10 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(7.5f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 10 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(26.6f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 10 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(853.300049f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 1 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 2 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 4 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 8 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 16 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 32 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 64 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x2, 0x00 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x4, 0x00 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);
            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x8, 0x00 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x10, 0x00 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(12.727273f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(488f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(9.42f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 160 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(10f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 160 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(10f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(9.42f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);

            Assert.AreEqual(10f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 1 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x00, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 2 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x00, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x00, 0x40 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x00, 0x40 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x00, 0x10 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x00, 0x20 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x00, 0x40 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x00, 0x80 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x01, 0x00 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x02, 0x00 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x04, 0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 1 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x08, 0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x10, 0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x20, 0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x40, 0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x80, 0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x1 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x2 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x4 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x8 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x1, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x2, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x4, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x8, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 10 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(10f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 150 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(0.37041536f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x4 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(-32f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(39.2156868f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(266f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 150 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(54.27f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 4 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(-36f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x1 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x8 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x10 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x20 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x40 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x80 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x01, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x02, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x04, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x08, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x10, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x20, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x40, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x80, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x00, 0x1 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x2 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x04 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x8 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            //li = _ecu.Sensors[i] as LocalIdentifier;
            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x0, 0 };

            //Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            //Assert.AreEqual(0, tsm.Measurement);

            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x0, 0x10 };

            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            //Assert.AreEqual(1, tsm.Measurement);

            //i++;

            //li = _ecu.Sensors[i] as LocalIdentifier;
            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x0, 0 };

            //Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            //Assert.AreEqual(0, tsm.Measurement);

            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x0, 0x20 };

            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            //Assert.AreEqual(1, tsm.Measurement);

            //i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x40 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x80 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            //li = _ecu.Sensors[i] as LocalIdentifier;
            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x0, 0 };

            //Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            //Assert.AreEqual(0, tsm.Measurement);

            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x01, 0x0 };

            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            //Assert.AreEqual(1, tsm.Measurement);

            //i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x02, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x04, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x08, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x10, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x20, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x01 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x2 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x04 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x08 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            //li = _ecu.Sensors[i] as LocalIdentifier;
            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x0, 0 };

            //Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            //Assert.AreEqual(0, tsm.Measurement);

            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x0, 0x10 };

            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            //Assert.AreEqual(1, tsm.Measurement);

            //i++;

            //li = _ecu.Sensors[i] as LocalIdentifier;
            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x0, 0 };

            //Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            //Assert.AreEqual(0, tsm.Measurement);

            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x0, 0x20 };

            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            //Assert.AreEqual(1, tsm.Measurement);

            //i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x40 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x80 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            //li = _ecu.Sensors[i] as LocalIdentifier;
            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x0, 0 };

            //Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            //Assert.AreEqual(0, tsm.Measurement);

            //_device.LocalidentifierData = new byte[] { 0x61, (Byte) li.Id, 0x01, 0x0 };

            //tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            //Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            //Assert.AreEqual(1, tsm.Measurement);

            //i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x02, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x04, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x08, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x10, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x20, 0x0 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 4 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(-32f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(-6.23178196f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x3, 0xe8 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(0.38153377f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 215 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(100f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(100f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0xff, 0xff };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(1.49998474f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0xff, 0xff };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(1.49998474f, tsm.Measurement);

            i++;

            for (int j = 1; j < 0x2000; )
            {
                var bytes = BitConverter.GetBytes(j);
                li = _ecu.Sensors[i] as LocalIdentifier;
                _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0, 0 };

                Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
                tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
                Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultFalse, tsm.Status);
                Assert.AreEqual(0, tsm.Measurement);

                _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, bytes[1], bytes[0] };

                tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
                Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
                Assert.AreEqual(1, tsm.Measurement);

                i++;
                j <<= 1;
            }

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x1, 00 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(0.632175565f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x1, 00 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(0.632175565f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[0].MaskResultTrue, tsm.Status);
            Assert.AreEqual(0, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x1 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[1].MaskResultTrue, tsm.Status);
            Assert.AreEqual(1, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x2 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[2].MaskResultTrue, tsm.Status);
            Assert.AreEqual(2, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x3 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[3].MaskResultTrue, tsm.Status);
            Assert.AreEqual(3, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x4 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[4].MaskResultTrue, tsm.Status);
            Assert.AreEqual(4, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x5 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[5].MaskResultTrue, tsm.Status);
            Assert.AreEqual(5, tsm.Measurement);

            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 0x6 };

            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(_ecu.Sensors[i].MaskMatches[6].MaskResultTrue, tsm.Status);
            Assert.AreEqual(6, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x1, 00 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(2f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 100 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(266f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 41 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(1f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 41 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(116f, tsm.Measurement);

            i++;

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 41 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(116f, tsm.Measurement);

            i++;
#warning EGAS

            li = _ecu.Sensors[i] as LocalIdentifier;
            _device.LocalidentifierData = new byte[] { 0x61, (Byte)li.Id, 0x0, 200 };

            Console.WriteLine(string.Format("Testing Sensor : {0}", _ecu.Sensors[i].Name));
            tsm = _ecu.ReadSensor(_ecu.Sensors[i]);
            Assert.AreEqual(0.9765625f, tsm.Measurement);

            i++;
        }

        private void AssertSnapshot(Ecu ecu, Int32 index, IEnumerable<byte> data, String matchString)
        {
            SnapshotDefinition snapshot = ecu.SnapshotDefinitions[index];
            var dataBytes = new List<byte>(new byte[] { 0x61, snapshot.Identifier });
            dataBytes.AddRange(data);

            _device.LocalidentifierData = dataBytes.ToArray();

            String snapshotResult = ecu.ReadSnapshot(snapshot);

            Console.WriteLine(snapshotResult);

            Assert.AreEqual(matchString, snapshotResult);
        }
    }
}